/*工作统计旧接口，待删除*/
function mandy_get_group_members_scheduling(groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/group_members_scheduling.json", dto, success, fail);
}

/*工作统计旧接口，待删除*/
function mandy_get_group_scheduling(groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/group_scheduling.json", dto, success, fail);
}

/*工作统计旧接口，待【开发】后删除*/
function mandy_get_my_scheduling_sync(therapistId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.therapist_id = therapistId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGetSyn("/mandy/my_scheduling.json", dto, success, fail);
}

/*工作统计旧接口，待【开发】后删除*/
function mandy_get_group_scheduling_sync(groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGetSyn("/mandy/group_scheduling.json", dto, success, fail);
}

/*整理接口,2017/07/25, author:lanlan.zeng*/
//分页查询信息
function mandy_get_my_message_by_page(bussTypes, isRead, pageSize, time, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    //dto.current_page = currentPage;
    dto.page_size = pageSize;
    dto.time = time;
    dto.is_read = isRead;
    if (bussTypes != null) {
        dto.buss_types = bussTypes;
    }

    doGet("/mandy/my_message_by_page.json", dto, success, fail);
}

//获取未读信息数
function mandy_get_my_message_unread_count(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_message_unread_count.json", dto, success, fail);
}

//标记已读信息
function mandy_put_message_is_read(messageId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.message_id = messageId;

    doPutSyn("/mandy/message_is_read.json", dto, success, fail);
}

//获取我的任务
function mandy_get_my_task(searchKey, page, page_size, status, sortType, success, fail) {
    var dto = {};

    dto.current_page = page;
    dto.page_size = page_size;
    dto.status = status;
    dto.search_key = searchKey;
    dto.sort_type = sortType;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/gauge_record_by_page.json", dto, success, fail);
}

//完成评估量表
function mandy_post_gauge_record_result(gaugeRecordId, result, success, fail) {
    var dto = {};

    dto.gauge_record_id = gaugeRecordId;
    dto.result = result;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/gauge_record_result.json", dto, success, fail);
}

//未完成工作评估数
function mandy_get_my_task_count(searchKey, status, success, fail) {
    var dto = {};

    dto.status = status;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/gauge_record_count.json", dto, success, fail);
}

//治疗师个人工作统计
function mandy_get_my_scheduling(therapistId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.therapist_id = therapistId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/my_scheduling.json", dto, success, fail);
}

//工作统计明细
function mandy_get_staff_statistics(groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/get_staff_statistics.json", dto, success, fail);
}

//工作统计累计
function mandy_get_staff_statistics_count(groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/get_staff_statistics_count.json", dto, success, fail);
}

//增加医务人员
function mandy_add_medical_info(mobile, pwd, name, sex, birthday, divisionId, job, roleId,teacherId, treatmentGroupId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.mobile = mobile;
    dto.pwd = hex_md5(pwd + "{cloud}");
    dto.name = name;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.division_id = divisionId;
    dto.job = job;
    dto.role_id = roleId;
    dto.teacherId = teacherId;
    dto.treatment_group_id = treatmentGroupId;
    doPost("/mandy/medical_info.json", dto, success, fail);
}

//查询设备类型
function mandy_get_all_device_type_syn(success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGetSyn("/mandy/get_all_type.json", dto, success, fail);
}

/*//通过设备类型查询治疗项目和负责人
function mandy_get_item_profile_syn(typeId,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.typeId = typeId;
    doGetSyn("/mandy/get_item_profile.json", dto, success, fail);
}
*/

//通过设备类型查询负责人
function mandy_get_leader(itemTypeId,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.itemTypeId = itemTypeId;
    doGet("/mandy/get_leader.json", dto, success, fail);
}

//通过设备类型查询项目
function mandy_get_device_project(typeId,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.typeId = typeId;
    doGet("/mandy/get_device.json", dto, success, fail);
}


/*//添加设备
function mandy_add_device(type_id,name,subitem_id,subitem_name,treatment_time,price,profile_id,director,remark,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.type_id = type_id;
    dto.name = name;
    dto.subitem_id = subitem_id;
    dto.subitem_name = subitem_name;
    dto.treatment_time = treatment_time;
    dto.price = price;
    dto.profile_id = profile_id;
    dto.director = director;
    dto.remark = remark;
   
    doPost("/mandy/add_device.json", dto, success, fail);
}
*/

//添加设备(新接口)
function mandy_post_add_device_lev2(type_id,name,subitem_id,subitem_name,profile_id,director,treatPeople,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.type_id = type_id;
    dto.name = name;
    /*dto.subitem_id = subitem_id;*/
    dto.subitem_name = subitem_name;
    dto.profile_id = profile_id;
    dto.director = director;
    dto.treatPeople = treatPeople;
    
    /*doPost("/mandy/add_device_lev2.json", dto, success, fail);*/
    //新接口，添加设备的同时批量添加项目关联
    dto.subitem_ids = [subitem_id];
    doPost("/mandy/add_device_and_items.json", dto, success, fail);
}

//分页查询设备列表
function mandy_device_list_by_page(searchKey, page, pageSize,success,fail){
    
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.search_key = searchKey;
    dto.page = page;
    dto.page_size = pageSize;

    doGet("/mandy/device_list_by_page.json", dto, success, fail);
}

//查看单条设备信息
function mandy_get_device_by_id(id,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    doGet("/mandy/get_device_by_id.json", dto, success, fail);
}

/*//修改设备信息
function mandy_update_device_info(id,type_id,name,subitem_id,subitem_name,treatment_time,price,profile_id,director,remark,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    dto.type_id = type_id;
    dto.name = name;
    dto.subitem_id = subitem_id;
    dto.subitem_name = subitem_name;
    dto.treatment_time = treatment_time;
    dto.price = price;
    dto.profile_id = profile_id;
    dto.director = director;
    dto.remark = remark;
    doPut("/mandy/update_device_info.json", dto, success, fail);
}
*/
//修改设备信息(新接口)
function mandy_update_device(id,treatPeople,director,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    dto.treatPeople = treatPeople;
    dto.director = director;
    
    doPost("/mandy/update_device.json", dto, success, fail);
}


//获取医务人员（分页）
function mandy_get_medical_list_by_page(searchKey, page, pageSize,trainee, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.search_key = searchKey;
    dto.page = page;
    dto.page_size = pageSize;
    dto.trainee = trainee;

    doGet("/mandy/medical_list_by_page.json", dto, success, fail);
}

//获取医院信息
function mandy_get_hospital(id, success, fail) {
    var getHospital = {};

    getHospital.hospital_id = id;

    doGet("/mandy/hospital.json", getHospital, success, fail);
}

//修改医务人员密码
function mandy_put_medical_pwd(medicalId, pwd, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.medical_id = medicalId;
    dto.pwd = hex_md5(pwd + "{cloud}");

    doPut("/mandy/medical_pwd.json", dto, success, fail);
}

//启用、禁用医务人员账户
function mandy_put_medical_disabled(medicalId, disabled, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.medical_id = medicalId;
    dto.disabled = disabled;

    doPut("/mandy/medical_disabled.json", dto, success, fail);
}

//启用、禁用设备
function mandy_put_device_disabled(deviceId, disabled, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.device_id = deviceId;
    dto.disabled = disabled;

    doPut("/mandy/device_disabled.json", dto, success, fail);
}

//修改医务人员资料
function mandy_put_medical_info(medicalId, name, sex, birthday, divisionId, job, roleId, treatmentGroupId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.medical_id = medicalId;
    dto.name = name;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.division_id = divisionId;
    dto.job = job;
    dto.role_id = roleId;
    dto.treatment_group_id = treatmentGroupId;

    doPut("/mandy/medical_info.json", dto, success, fail);
}

//查看个人资料
function mandy_get_profile(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/profile.json", dto, success, fail);
}

//查看医务人员资料
function mandy_get_medical_staff(medical_staff_id, success, fail) {
    var dto = {};
    dto.medical_staff_id = medical_staff_id;
    doGet("/mandy/medical_staff.json", dto, success, fail);
}

//查看医务人员列表
function get_medical_staff_list(success, fail){
	var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/get_medical_staff_list.json", dto, success, fail);
}

//查看医生列表
function mandy_get_medical_staff_list(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, success, fail) {
    mandy_get_medical_staff_list_by_page(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, 1, 10000, success, fail)
}

//查看医生列表
function mandy_get_medical_staff_list_by_page(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize, success, fail) {
    var dto = {};
    if (types != null) {
        dto.types = types;
    }
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.page = page;
    dto.page_size = pageSize;
    dto.tag_id = tagId;
    dto.sort_type = sortType;
    //if(!addTokenToDTO(dto)) {return;}
    doGet("/mandy/medical_staff_list.json", dto, success, fail);
}

//获取科室列表
function mandy_get_division_list_syn(hospitalId, success, fail) {
    var getDivisionList = {};
    getDivisionList.hospital_id = hospitalId;
    addTokenToDTO(getDivisionList);

    doGetSyn("/mandy/division_list.json", getDivisionList, success, fail);
}

//获得治疗组列表（同步）
function mandy_get_treatment_group_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/treatment_group.json", dto, success, fail);
}

//获得治疗组列表
function mandy_get_treatment_group(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/treatment_group.json", dto, success, fail);
}

//获得实习医生导师列表
function mandy_get_treat_group_teacher(group_id,success, fail) {
    var dto = {};
    dto.groupId = group_id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/treat_group_teacher.json", dto, success, fail);
}

//获取疾病列表
function mandy_get_disease_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/disease_list.json", dto, success, fail);
}

//获取病种列表
function mandy_get_gauge_list(diseaseId, success, fail) {
    var dto = {};
    dto.disease_id = diseaseId;
    doGet("/mandy/gauge_list.json", dto, success, fail);
}

//查看患者病历信息(根据病历id)
function mandy_get_emr(id, referralId,number, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    dto.referral_id = referralId;
    dto.number = number;
    doGet("/mandy/emr.json", dto, success, fail);
}

//查看患者病历信息(根据患者编号)
function mandy_get_emr_by_number_hospitalId(number, success, fail) {
    var dto = {};

    dto.number = number;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/emr.json", dto, success, fail);
}



//新建转诊门诊查看患者信息(根据身份证号)
function mandy_get_emr_by_identity_card(identityCard, success, fail) {
    var dto = {};

    dto.identity_card = identityCard;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/match_emr.json", dto, success, fail);
}

//新建门诊转诊匹配并新建病历
function mandy_post_match_emr(referralId,emrId,success,fail){
    var dto = {};

    dto.referral_id = referralId;
    dto.emr_id = emrId;

    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doPost("/mandy/match_emr.json", dto, success, fail);
}

//新建门诊转诊新建病历
function mandy_post_add_emr(dto,success,fail){

    var dto = dto;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doPost("/mandy/in_emr.json", dto, success, fail);
}


//查看医院的患者
function mandy_get_all_emr(searchKey, hospitalId, page, page_size, success, fail) {
    var dto = {};

    dto.hospital_id = hospitalId;
    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/all_emr.json", dto, success, fail);
}

//查看我的患者
function mandy_get_my_emr(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_emr.json", dto, success, fail);
}

//查看我的患者(检查报告)
function mandy_get_my_emr_with_count(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_emr_with_count.json", dto, success, fail);
}

//查看我的患者(治疗方案)
function mandy_get_my_emr_with_able(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_emr_with_able.json", dto, success, fail);
}

//查询转出患者
function mandy_get_out_emr(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/out_emr.json", dto, success, fail);
}
//查询转入患者
function mandy_get_in_emr(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/in_emr.json", dto, success, fail);
}

//转出患者
function mandy_post_out_emr(EMRId, inHosId, inMedicalId,info, remark,remarkVal, success, fail) {
    var dto = {};

    dto.emr_id = EMRId;
    dto.in_hospital_id = inHosId;
    dto.in_medical_id = inMedicalId;
    dto.receive_hos_div_acc = info;
    dto.prescribed = remark;
    dto.remark = remarkVal;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/out_emr.json", dto, success, fail);
}

//转诊接收的医生列表
function mandy_get_receive_doctor_list_sync(referralId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.referral_id = referralId;

    doGetSyn("/mandy/receive_doctor_list.json", dto, success, fail);
}

//指定转诊医生
function mandy_put_receive_medical(referralId, medicalId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.referral_emr_id = referralId;
    dto.medical_id = medicalId;

    doPut("/mandy/receive_medical.json", dto, success, fail);
}

//添加处方(老)
function mandy_add_prescription(type, diagnose, diagnoseRemark, description, EMRId, items, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.type = type;
    dto.diagnose = diagnose;
    dto.diagnose_remark = diagnoseRemark;
    dto.description = description;
    dto.medical_record = {};
    dto.medical_record.id = EMRId;
    dto.prcp_item_list = items;

    doPost("/mandy/prescription.json", dto, success, fail);
}

//增加模板
function mandy_add_template(part,content,success, fail) {
    var dto = {};
    dto.content = content;
    dto.part = part;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/add_template.json", dto, success, fail);
}


//获取模板
function mandy_get_templates(part,page, pageSize, success, fail) {
    var dto = {};
    dto.part = part;
    dto.page = page;
    dto.page_size = pageSize;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/get_templates.json", dto, success, fail);
}

//删除模板
function mandy_delete_template(id,success, fail) {
    var dto = {};
    dto.id = id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/delete_template.json", dto, success, fail);
}

//新增治疗方案
function mandy_post_training_plan(emrId, plan, prcpItemId, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.plan = plan;
    dto.prcp_item_id = prcpItemId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/training_plan.json", dto, success, fail);
}

//分页查询治疗方案
function mandy_get_emr_group_training_plan(emrId,is_referral_history, itemType, page, pageSize, success, fail) {
    var dto = {};
    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;
    dto.item_type = itemType;
    dto.page = page;
    dto.page_size = pageSize;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/emr_group_training_plan.json", dto, success, fail);
}

//查询治疗方案总数
function mandy_get_emr_group_training_plan_count(emrId,is_referral_history, itmeType, success, fail) {
    var dto = {};
    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;
    dto.item_type = itemType;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/emr_group_training_plan_count.json", dto, success, fail);
}

//获取市的行政区域
function mandy_get_district_list(cityId, success, fail) {
    var dto = {};
    dto.city_id = cityId;
    doGet("/mandy/district_list.json", dto, success, fail);
}

//转诊统计
function mandy_get_hospital_referral_stat(startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.start_date = startTime;
    dto.end_date = endTime;

    doGet("/mandy/statistics_referral.json", dto, success, fail);
}
//转诊统计（统计整个系统）
function mandy_get_hospital_referral_stat_admin(startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/referral_statistics_admin.json", dto, success, fail);
}

//增加医院
function mandy_add_hospital(hospitalDto, success, fail) {
    var dto = {};
    dto.hospital = hospitalDto;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/hospital.json", dto, success, fail);
}

//获取治疗组成员
function mandy_get_treat_group_members(groupId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.group_id = groupId;
    doGet("/mandy/treat_group_members.json", dto, success, fail);
}

//获取治疗组成员（同步）
function mandy_get_treat_group_members_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/treat_group_members.json", dto, success, fail);
}

//查看我的治疗组
function mandy_get_my_treat_group_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/my_treat_group.json", dto, success, fail);
}

//根据转诊记录id获取单条转诊记录
function mandy_get_referral_emr(id, type, success, fail) {
    var dto = {};

    dto.referral_emr_id = id;
    dto.medical_type = type;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/referral_emr.json", dto, success, fail);
}

//根据病历ID获取从其他医院转入本医院的转诊记录列表
function mandy_get_referral_emr_list(inId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.in_id = inId;
    doGet("/mandy/referral_emr_list.json", dto, success, fail);
}

//新增病历记录
function mandy_add_clinic(diagnoseId, emrId, diseaseId, diseaseInfo, otherInfo, diagnoseRemark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.diagnose_id = diagnoseId;
    dto.emr_id = emrId;
    dto.disease_id = diseaseId;
    dto.disease_info = diseaseInfo;
    dto.other_info = otherInfo;
    dto.diagnose_remark = diagnoseRemark;
    doPost("/mandy/clinic.json", dto, success, fail);
}

//7日内编辑病历记录
function mandy_update_clinic(diagnoseId, clinicId, diseaseId, diseaseInfo, otherInfo, diagnoseRemark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.diagnose_id = diagnoseId;
    dto.clinic_id = clinicId;
    dto.disease_id = diseaseId;
    dto.disease_info = diseaseInfo;
    dto.other_info = otherInfo;
    dto.diagnose_remark = diagnoseRemark;
    doPut("/mandy/update_clinic.json", dto, success, fail);
}

//快速转诊的增加病历记录
function mandy_add_clinic2(diagnoseId, emrId, diseaseId, diseaseInfo, otherInfo, diagnoseRemark, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.diagnose_id = diagnoseId;
    dto.emr_id = emrId;
    dto.disease_id = diseaseId;
    dto.disease_info = diseaseInfo;
    dto.other_info = diseaseInfo;
    dto.diagnose_remark = diagnoseRemark;
    doPostSyn("/mandy/clinic2.json", dto, success, fail);
}

//接诊医生创建患者病历
function mandy_post_in_emr(transferId, emr, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.referral_emr_id = transferId;
    dto.in_emr = emr;

    doPost("/mandy/in_emr.json", dto, success, fail);
}

//医生接诊
function mandy_put_referral_emr(referralEmrId, messageId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.message_id = messageId;
    dto.referral_emr_id = referralEmrId;

    doPut("/mandy/referral_emr.json", dto, success, fail);
}

//分页获取治疗师的治疗项目
function mandy_get_my_prescription_item_list(searchKey, page, pageSize, type, startDate, prcpType, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.page = page;
    dto.page_size = pageSize;
    dto.type = type;
    dto.start_date = startDate;
    dto.prcp_type = prcpType;
    dto.search_key = searchKey;

    doGet("/mandy/my_prescription_item_list.json", dto, success, fail);
}

//上传检查报告
function mandy_post_inspection_report(inspectionReport, success, fail) {
    var dto = {};
    dto.inspection_report = inspectionReport;


    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/inspection_report.json", dto, success, fail);
}

//查看检查报告
function mandy_get_inspection_report(inspectionReportId,emr_id,is_referral_history, success, fail) {
    var dto = {};

    dto.id = inspectionReportId;
    dto.emr_id = emr_id;
    dto.is_referral_history = is_referral_history;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/inspection_report.json", dto, success, fail);
}
//获取患者的所有评估列表
function mandy_get_gauge_record_by_patient_id(status, patientId, success, fail) {
    var dto = {};

    dto.status = status;
    dto.patient_id = patientId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/gauge_record_by_patient_id.json", dto, success, fail);
}

//查询某个病历某一个具体的治疗单的所有康复训练方案
function mandy_get_emr_item_training_plan(emrId, prcpItemId, page, pageSize, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.prcp_item_id = prcpItemId;
    dto.page = page;
    dto.page_size = pageSize;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/emr_prcp_item_training_plan.json", dto, success, fail);
}

//查询某个病历某一个具体的治疗单的所有康复训练方案的总条数
function mandy_get_emr_item_training_plan_count(emrId, prcpItemId, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.prcp_item_id = prcpItemId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/emr_prcp_item_training_plan_count.json", dto, success, fail);
}

//查询某个病历各类治疗单中最新的一条康复训练方案
function mandy_get_newest_training_plan(emrId,is_referral_history, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/newest_training_plan.json", dto, success, fail);
}

//获取治疗师排班表(上午\下午)
function mandy_get_group_schedule_table(groupId,startDate,success,fail){
    var dto = {};

    dto.group_id = groupId;
    dto.start_date = startDate;

    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_group_schedule_table.json", dto, success, fail);
}

//获取groupId(各医院的不一样)
function mandy_hos_group_not_in(success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGetSyn("/mandy/hos_group_not_in.json",dto, success, fail);
}

//排班统计一览表_按组统计收费
function mandy_get_group_charges_static(groupId,startTime,endTime,success,fail){
    var dto = {};
    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/get_group_charges_static.json",dto, success, fail);
}

//排班统计一览表_饼图统计
function mandy_statistics_patient_prescription_by_group(startDate,endDate,success,fail){
    
    var dto = {};
    dto.start_date = startDate;
    dto.end_date = endDate;
    if (!addTokenToDTO(dto)) {GET 
        return;
    }
    doGet("/mandy/statistics_patient_prescription_by_group.json",dto, success, fail);
}

//排班统计一览表_按组统计次数
function mandy_statistics_patient_prescription_by_therapist(groupId,startDate,endDate,success,fail){
    
    var dto = {};
    dto.group_id = groupId;
    dto.start_date = startDate;
    dto.end_date = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/statistics_patient_prescription_by_therapist.json",dto, success, fail);
}

//转诊统计(按医院等级分组)
function mandy_statistics_referral(startDate,endDate,success,fail){
    
    var dto = {};
    dto.start_date = startDate;
    dto.end_date = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/statistics_referral.json",dto, success, fail);
}

//治疗师人员统计
function mandy_statistics_profile(groupId,startDate,endDate,success,fail){
    
    var dto = {};
    dto.group_id = groupId;
    dto.start_date = startDate;
    dto.end_date = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/statistics_profile.json",dto, success, fail);
}

//质控统计整体趋势饼图
function mandy_statistic_new_patient(startDate,endDate,success,fail){
    
    var dto = {};
    dto.start_date = startDate;
    dto.end_date = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/statistic_new_patient.json",dto, success, fail);
}


//质控统计治疗师收费饼图
function mandy_get_overall_charges_static(startDate,endDate,success,fail){
    
    var dto = {};
    dto.start_time = startDate;
    dto.end_time = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_overall_charges_static.json",dto, success, fail);
}

//质控统计治疗师收费柱状图及列表
function mandy_get_overall_charges_static_detail(groupId,startDate,endDate,success,fail){
    
    var dto = {};
    dto.group_id = groupId;
    dto.start_time = startDate;
    dto.end_time = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_overall_charges_static_detail.json",dto, success, fail);
}


//质控统计治疗师收费列表查看详情
function mandy_get_therapist_charges_static(therapistId,startDate,endDate,success,fail){
    
    var dto = {};
    dto.therapist_id = therapistId;
    dto.start_time = startDate;
    dto.end_time = endDate;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_therapist_charges_static.json",dto, success, fail);
}

//质控统计患者收费
function mandy_get_patient_charges_static(searchKey,success,fail){
    
    var dto = {};
    dto.search_key = searchKey;
    
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_patient_charges_static.json",dto, success, fail);
}

//转诊统计详情按医院查询
function mandy_statistics_referral_by_medical(hospitalId,startDate,endDate,success,fail){
    
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.start_date = startDate;
    dto.end_date = endDate;
    
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/statistics_referral_by_medical.json",dto, success, fail);
}


//转诊统计详情按医院及医生查询
function mandy_statistics_referral_by_patient(medicalId,hospitalId,/*startDate,endDate,*/success,fail){
    
    var dto = {};
    dto.medical_id = medicalId;
    dto.hospital_id = hospitalId;
    /*dto.start_date = startDate;
    dto.end_date = endDate;*/
    
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/statistics_referral_by_patient.json",dto, success, fail);
}

//转诊统计详情获取医院列表
function mandy_get_hospitals(success,fail){
    
    var dto = {};
    
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/hospitals.json",dto, success, fail);
}

//转诊统计详情根据医院id查该医院的医生
function mandy_get_doctor_staff_list(hospitalId,success,fail){
    
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.station = "doctor";
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/doctor_staff_list.json",dto, success, fail);
}

//首页存档
function mandy_put_is_save(emrId,success,fail){
    
    var dto = {};
    dto.emr_id = emrId;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/is_save.json",dto, success, fail);
}


//转诊历史时间轴
function mandy_get_referral_history(emrId,success,fail){
    
    var dto = {};
    dto.emr_id = emrId;
   
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/referral_history.json",dto, success, fail);
}

//获取套餐列表
function mandy_get_package_list(success,fail){
    
    var dto = {};
    //dto.type = type;
   
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/package_list.json",dto, success, fail);
}

//根据套餐id获取套餐项目
function mandy_get_prescriptionSubitem_by_pid(pid,success,fail){
    
    var dto = {};
    dto.pid = pid;
   
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_prescriptionSubitem_by_pid.json",dto, success, fail);
}



//根据套餐类型获取治疗师列表
function mandy_get_therapist_by_typeId(typeId,success,fail){
    
    var dto = {};
    dto.typeId = typeId;
   
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGetSyn("/mandy/get_therapist_by_typeId.json",dto, success, fail);
}

//添加套餐或训练处方
function mandy_post_add_package_prescription(is_package,result,success,fail){
    
    var dto = {};
    dto.train = result;
    dto.is_package = is_package;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doPost("/mandy/add_prescription.json",dto, success, fail);
}

//增加项目管理
function mandy_post_add_subitem(type_id,itemName,itemCode,unitFee,is_use,treat_time,success,fail){
    
    var dto = {};
    dto.typeId = type_id;
    dto.itemName = itemName;
    dto.itemCode = itemCode;
    dto.unitFee = unitFee;
    dto.isUse = is_use;
    dto.treatTime = treat_time;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doPost("/mandy/add_subitem.json",dto, success, fail);
}

//获取项目列表
function mandy_get_subitem_list_by_page(searchKey,page,pageSize,success,fail){
    
    var dto = {};
    dto.searchKey = searchKey;
    dto.page = page;
    dto.pageSize = pageSize;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doGet("/mandy/get_subitem.json",dto, success, fail);
}

//查看单条项目信息
function mandy_get_subitem_by_id(id,success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    doGet("/mandy/get_subitem_by_id.json", dto, success, fail);
}

//修改项目管理
function mandy_update_subitem(id,typeId,type,itemName,itemCode,isUse,unitFee,treat_time,success,fail){
    
    var dto = {};
    dto.id = id;
    dto.typeId = typeId;
    dto.type = type;
    dto.itemName = itemName;
    dto.itemCode = itemCode;
    dto.unitFee = unitFee;
    dto.treatTime = treat_time;
    dto.isUse = isUse;
    if (!addTokenToDTO(dto)) {
        return;
    }
    
    doPost("/mandy/update_subitem.json",dto, success, fail);
}

//启用禁用项目
function mandy_update_subitem_disabled(id, disabled, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;
    dto.disabled = disabled;

    doPost("/mandy/update_subitem_disabled.json", dto, success, fail);
}

//获取项目管理处方类别和设备管理设备类别
function mandy_get_prescriptionType_syn(success,fail){
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGetSyn("/mandy/get_prescriptionType.json", dto, success, fail);
}

//患者收费明细
function mandy_get_patient_charges_static_detail(patient_id,start_time,end_time,success,fail){
    var dto = {};
    dto.patient_id = patient_id;
    dto.start_time = start_time;
    dto.end_time = end_time;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGetSyn("/mandy/get_patient_charges_static_detail.json", dto, success, fail);
}




















/*****************未知*********************/
//获取量表列表???
function mandy_get_gauge_record(gaugeRecordId, prcpItemId, success, fail) {
    var dto = {};

    dto.gauge_record_id = gaugeRecordId;
    dto.prcp_item_id = prcpItemId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/gauge_record.json", dto, success, fail);
}

//查询可添加训练方案的最新的一个治疗单
function mandy_get_newest_prcp_item(emrId, success, fail) {
    var dto = {};

    dto.emr_id = emrId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/newest_prcp_item.json", dto, success, fail);
}

//根据id获取某个具体的治疗单
function mandy_get_prescription_item(id, success, fail) {
    var dto = {};

    dto.id = id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/prescription_item.json", dto, success, fail);
}

//查看治疗记录
function mandy_get_treatment_record_list(emrId,is_referral_history, itemType, itemId, page, pageSize, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;
    dto.item_type = itemType;
    dto.item_id = itemId;
    dto.page = page;
    dto.page_size = pageSize;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/treatment_record_list.json", dto, success, fail);
}

//重新评估
function mandy_post_gauge_record_re_evaluation(prcpItemId, result, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.prcp_item_id = prcpItemId;
    dto.result = result;

    doPost("/mandy/gauge_record_re_evaluation.json", dto, success, fail);
}

//病历记录分页查询
function mandy_get_clinic_list(emrId,is_referral_history ,page, pageSize, success, fail) {
    var dto = {};
    dto.is_referral_history = is_referral_history;
    dto.emr_id = emrId;
    dto.page = page;
    dto.page_size = pageSize;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/emr_clinic_list.json", dto, success, fail);
}

/**
 * @author: ares
 * @date: 2019/3/21 9:55
 * @description: 查询会诊记录
 * @param {string}emrId
 * @param {number}page
 * @param {number}pageSize
 * @param {function}success
 * @param {function}fail
 */
function mandy_get_consultation_list(emrId ,page, pageSize, success, fail) {
	var dto = {};
	dto.emr_id = emrId;
	dto.page = page;
	dto.page_size = pageSize;
	if (!addTokenToDTO(dto)) {
		return;
	}
	doGet("/mandy/consultation_list.json", dto, success, fail);
}

/**
 * @author: ares
 * @date: 2019/3/21 15:30
 * @description: 获取会诊详情
 * @param {string}id    会诊id
 * @param {function}success
 * @param {function}fail
 */
function mandy_get_consultation_detail(id , success, fail) {
    var dto = {};
    dto.id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/consultation.json", dto, success, fail);
}

//获取检查报告列表
function mandy_get_inspection_report_list(patientId,emr_id,is_referral_history, success, fail) {
    var dto = {};
    dto.patient_id = patientId;
    dto.emr_id = emr_id;
    dto.is_referral_history = is_referral_history;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/inspection_report_list.json", dto, success, fail);
}

//分页查询检查报告
function mandy_get_inspection_report_list_by_page(patientId, page,pageSize,success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.patient_id = patientId;
    dto.page = page;
    dto.page_size = pageSize;

    doGet("/mandy/inspection_report_list_by_page.json", dto, success, fail);
}

//获得病历记录
function mandy_get_clinic(id,emr_id,is_referral_history, success, fail) {
    var dto = {};

    dto.id = id;
    dto.emr_id = emr_id;
    dto.is_referral_history = is_referral_history;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/clinic.json", dto, success, fail);
}

//获取该患者下同种评估类型的列表
function mandy_get_gauge_record_by_prcp_item_id(prcpItemId, success, fail) {
    var dto = {};
    dto.prcp_item_id = prcpItemId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/gauge_record_by_prcp_item_id.json", dto, success, fail);
}

//根据id获取治疗记录
function mandy_get_treatment_record(recordId, success, fail) {
    var dto = {};

    dto.record_id = recordId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/treatment_record.json", dto, success, fail);
}

//查看治疗记录个数
function mandy_get_treatment_record_count(emrId,is_referral_history, itemType, itemId, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;
    dto.item_type = itemType;
    dto.item_id = itemId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/treatment_record_count.json", dto, success, fail);
}

//获取最新的治疗记录
function mandy_get_newest_treatment_records(emrId,is_referral_history, success, fail) {
    var dto = {};

    dto.emr_id = emrId;
    dto.is_referral_history = is_referral_history;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/newest_treatment_records.json", dto, success, fail);
}

//删除治疗记录
function mandy_delete_treatment_record(id, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;

    doDelete("/mandy/treatment_record.json", dto, success, fail);
}

//查询治疗单对应的最新的一条康复训练方案
function mandy_get_item_newest_training_plan(itemIds, success, fail) {
    var dto = {};
    dto.item_ids = itemIds;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/item_newest_training_plan.json", dto, success, fail);
}
/********治疗师接口*/
//对康复训练的确认完成
function mandy_put_treatment_record_status(treatmentRecordId, condition, status, success, fail) {
    var dto = {};
    dto.record_id = treatmentRecordId;
    dto.condition = condition;
    dto.status = status;


    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/treatment_record_status.json", dto, success, fail);
}

//治疗师取消/修改排班
function mandy_put_therapist_schedule(prescriptionItemId, therapistId, patientId, timeList, recordIdList, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.prescription_item_id = prescriptionItemId;
    dto.therapist_id = therapistId;
    dto.patient_id = patientId;
    dto.time_block_list = timeList;
    dto.record_id_list = recordIdList;

    doPut("/mandy/therapist_schedule.json", dto, success, fail);
}

//分页获取治疗师的治疗项目
function mandy_get_group_prescription_item_list(searchKey, status, page, pageSize, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.status = status;
    dto.page = page;
    dto.page_size = pageSize;
    dto.search_key = searchKey;

    doGet("/mandy/group_prescription_item_list.json", dto, success, fail);
}

//治疗师添加排班
function mandy_post_therapist_schedule(prescriptionItemId, therapistId, weeks, timeList, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.prescription_item_id = prescriptionItemId;
    dto.therapist_id = therapistId;
    dto.weeks = weeks;
    dto.time_block_list = timeList;

    doPost("/mandy/therapist_schedule.json", dto, success, fail);
}

//获取某天某治疗师的排班信息
function mandy_get_therapist_schedule(therapistId, date, success, fail) {
    var dto = {};
    dto.therapist_id = therapistId;
    dto.date = date;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_schedule.json", dto, success, fail);
}

//获取某天某治疗师可排班的时间段
function mandy_get_therapist_schedule_period(therapistId,emrId, date, success, fail) {
    var dto = {};
    dto.therapist_id = therapistId;
    dto.emr_id = emrId;
    dto.date = date;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/schedule_period.json", dto, success, fail);
}

//治疗师获取治疗过的患者的病历列表
function mandy_get_therapist_emr_by_page(searchKey, page, page_size, success, fail) {
    var dto = {};

    dto.page = page;
    dto.page_size = page_size;
    dto.search_key = searchKey;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_emr_by_page.json", dto, success, fail);
}

//治疗师获取我的治疗记录
function mandy_get_therapist_treatment_record_by_page(searchKey, page, page_size, status, success, fail) {
    var dto = {};

    dto.current_page = page;
    dto.page_size = page_size;
    dto.status = status;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_treatment_record_by_page.json", dto, success, fail);
}

//治疗师获取我的治疗记录并获得是否做过治疗安排
function mandy_get_therapist_plan_treatment_record_by_page(searchKey, page, page_size, status, success, fail) {
    var dto = {};

    dto.current_page = page;
    dto.page_size = page_size;
    dto.status = status;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_plan_treatment_record_by_page.json", dto, success, fail);
}

//获取最旧的治疗小结
function mandy_get_oldest_treatment_summary(itemId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.item_id = itemId;

    doGet("/mandy/oldest_treatment_summary.json", dto, success, fail);
}

//获取假期
function mandy_get_vacation(therapistId, groupId, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    //dto.therapist_id = therapistId;
    dto.group_id = groupId;
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/vacation.json", dto, success, fail);
}

//增加假期
function mandy_add_vacation(medicalId, remark, isLoop, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    //dto.therapist_id = therapistId;
    dto.medical_id = medicalId;
    dto.start_time = startTime;
    dto.end_time = endTime;
    dto.remark = remark;
    dto.is_loop = isLoop;

    doPost("/mandy/vacation.json", dto, success, fail);
}

//删除假期
function mandy_delete_vacation(vacationId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.vacation_id = vacationId;

    doDelete("/mandy/vacation.json", dto, success, fail);
}

//修改假期
function mandy_put_vacation(vacationId, remark, isLoop, startTime, endTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.vacation_id = vacationId;
    dto.start_time = startTime;
    dto.end_time = endTime;
    dto.remark = remark;
    dto.is_loop = isLoop;

    doPut("/mandy/vacation.json", dto, success, fail);
}

//治疗师长获取本组某段时间的排班情况
function mandy_get_therapist_group_schedule_periods(startDate, endDate, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.start_date = startDate;
    dto.end_date = endDate;

    doGet("/mandy/therapist_group_schedule_periods.json", dto, success, fail);
}

//治疗师获取我的治疗记录数量
function mandy_get_therapist_treatment_record_count(searchKey, status, success, fail) {
    var dto = {};

    dto.status = status;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_treatment_record_count.json", dto, success, fail);
}

//治疗师获取我的治疗记录
function mandy_get_therapist_plan_treatment_record_count(searchKey, status, success, fail) {
    var dto = {};

    dto.status = status;
    dto.search_key = searchKey;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_plan_treatment_record_count.json", dto, success, fail);
}

//治疗师获取一段时间的排班（一般是一周）
function mandy_get_therapist_schedule_periods(therapistId, startDate, endDate, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.therapist_id = therapistId;
    dto.start_date = startDate;
    dto.end_date = endDate;

    doGet("/mandy/therapist_schedule_periods.json", dto, success, fail);
}

//修改治疗师
function mandy_set_pcrp_item_therapist(prcp_item_id, therapist_id, success, fail) {
    var dto = {};
    dto.therapist_id = therapist_id;
    dto.prcp_item_id = prcp_item_id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/prcp_item_therapist.json", dto, success, fail);
}

/*************************************************无用接口*******************************************************************/
/*function mandy_get_profile_sync(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGetSyn("/mandy/profile.json", dto, success, fail);
}

function mandy_set_profile(head, name, sex, birthday, success, fail) {
    var dto = {};
    dto.head = head;
    dto.name = name;
    dto.sex = sex;
    dto.birthday = birthday;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/profile.json", dto, success, fail);
}

//文件上传相关
function mandy_get_certificate_upload_info(file, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    var filename = file.name;

    dto.type = filename.substr(filename.lastIndexOf(".") + 1);

    if (dto.token == null || dto.token == "") {
        errorAlert("需要登陆");
        return false;
    }

    doGet("/mandy/certificate_upload_info.json", dto, success, fail);
}

//文件上传相关(同步接口)
function mandy_get_certificate_upload_info_syn(file, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    var filename = file.name;

    dto.type = filename.substr(filename.lastIndexOf(".") + 1);

    if (dto.token == null || dto.token == "") {
        errorAlert("需要登陆");
        return false;
    }

    doGetSyn("/mandy/certificate_upload_info.json", dto, success, fail);
}

//文件上传相关（压缩后调用）
function mandy_get_certificate_upload_info_compress(format, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.type = format;

    if (dto.token == null || dto.token == "") {
        errorAlert("需要登陆");
        return false;
    }

    doGet("/mandy/certificate_upload_info.json", dto, success, fail);
}

function mandy_get_avatar_upload_info(file, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    var filename = file.name;

    dto.type = filename.substr(filename.lastIndexOf(".") + 1);

    if (dto.token == null || dto.token == "") {
        errorAlert("需要登陆");
        return false;
    }

    doGet("/mandy/avatar_upload_info.json", dto, success, fail);
}

function mandy_get_hospital_list(name, cityId, success, fail) {
    var getHospitalList = {};

    //addTokenToDTO(getHospitalList);

    getHospitalList.hospital_name = name;
    getHospitalList.city_id = cityId;

    doGet("/mandy/hospital_list.json", getHospitalList, success, fail);
}

function mandy_get_division_list(hospitalId, success, fail) {
    var getDivisionList = {};
    getDivisionList.hospital_id = hospitalId;
    addTokenToDTO(getDivisionList);

    doGet("/mandy/division_list.json", getDivisionList, success, fail);
}

function mandy_get_role_list(success, fail) {
    var getRoleList = {};

    addTokenToDTO(getRoleList);

    doGet("/mandy/role_list.json", getRoleList, success, fail);
}
function mandy_get_role_list_syn(success, fail) {
    var getRoleList = {};

    addTokenToDTO(getRoleList);

    doGetSyn("/mandy/role_list.json", getRoleList, success, fail);
}
//医师相关
function mandy_add_medical_application(avatar_img, birthday, name, job, role, hospital_id,
                                       new_hospital, division_id, introduction,
                                       licence_img, certification_img, position,
                                       title, email, address, sex, create_time,
                                       update_time, success, fail) {
    var dto = {};
    dto.role = {};
    dto.role.id = role;
    dto.avatar_img = avatar_img;
    dto.birthday = birthday;
    dto.name = name;
    dto.job = job;
    dto.hospital = {};
    dto.sex = sex;
    dto.hospital.id = hospital_id;
    dto.new_hospital = new_hospital;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.position = position;
    dto.title = title;
    dto.contact_email = email;
    dto.address = address;

    dto.licence_img = licence_img[0];
    dto.licence_img_2 = licence_img[1];
    dto.certification_img = certification_img[0];
    dto.certification_img_2 = certification_img[1];

    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/medical_application.json", dto, success, fail);
}

//医师相关
function mandy_add_medical_application2(avatar_img, name, hospital_id, division_id, position, job, introduction, licence_img, success, fail) {
    var dto = {};
    dto.avatar_img = avatar_img;
    dto.name = name;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.job = job;
    dto.division = {};
    dto.division.id = division_id;
    dto.position = position;
    dto.introduction = introduction;
    dto.licence_img = licence_img;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/medical_application.json", dto, success, fail);
}

//医师相关
function mandy_get_medical_application(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/medical_application.json", dto, success, fail);
}

function mandy_medical_application_approval(apply_id, hospital_id, status, remark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.apply_id = apply_id;
    dto.hospital_id = hospital_id;
    dto.status = status;
    dto.remark = remark;

    doPut("/mandy/medical_application_approval.json", dto, success, fail);
}


//医师相关
function mandy_add_doctor_application(avatar_img, role, hospital_id, new_hospital, division_id, introduction, licence_img, certification_img, position, title, email, address, create_time, update_time, success, fail) {
    var dto = {};
    dto.role = {};
    dto.role.id = role;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.new_hospital = new_hospital;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.position = position;
    dto.title = title;
    dto.contact_email = email;
    dto.address = address;

    dto.licence_img = licence_img;
    dto.certification_img = certification_img;

    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/doctor_application.json", dto, success, fail);
}

function mandy_update_doctor_application(apply_id, hospital_id, division_id, introduction, licence_img, certification_img, create_time, update_time, success, fail) {
    var dto = {};
    dto.apply_id = apply_id;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.licence_img = licence_img;
    dto.certification_img = certification_img;
    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/doctor_pro_application.json", dto, success, fail);
}

function mandy_get_doctor_application(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/doctor_application.json", dto, success, fail);
}

function mandy_doctor_application_approval(apply_id, status, remark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.apply_id = apply_id;
    dto.status = status;
    dto.remark = remark;

    doPut("/mandy/doctor_application_approval.json", dto, success, fail);
}

//专家医师相关
function mandy_add_doctor_pro_application(avatar_img, role, hospital_id, new_hospital, division_id, introduction, licence_img, certification_img, position, title, email, address, create_time, update_time, success, fail) {
    var dto = {};
    dto.role = {};
    dto.role.id = role;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.new_hospital = new_hospital;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.position = position;
    dto.title = title;
    dto.contact_email = email;
    dto.address = address;

    dto.licence_img = licence_img;
    dto.certification_img = certification_img;

    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/doctor_pro_application.json", dto, success, fail);
}

function mandy_update_doctor_pro_application(apply_id, hospital_id, division_id, position, title, introduction, licence_img, certification_img, create_time, update_time, success, fail) {
    var dto = {};
    dto.apply_id = apply_id;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.division = {};
    dto.division.id = division_id;
    dto.position = position;
    dto.title = title;
    dto.introduction = introduction;
    dto.licence_img = licence_img;
    dto.certification_img = certification_img;
    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/doctor_pro_application.json", dto, success, fail);
}

function mandy_get_doctor_pro_application(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/doctor_pro_application.json", dto, success, fail);
}

function mandy_doctor_pro_application_approval(apply_id, status, remark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.apply_id = apply_id;
    dto.status = status;
    dto.remark = remark;

    doPut("/mandy/doctor_pro_application_approval.json", applicationApprovalDTO, success, fail);
}

//护士相关
function mandy_add_nurse_application(avatar_img, role, hospital_id, new_hospital, division_id, introduction, licence_img, certification_img, position, title, email, address, create_time, update_time, success, fail) {
    var dto = {};
    dto.role = {};
    dto.role.id = role;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.new_hospital = new_hospital;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.position = position;
    dto.title = title;
    dto.contact_email = email;
    dto.address = address;

    dto.licence_img = licence_img;
    dto.certification_img = certification_img;

    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/nurse_application.json", dto, success, fail);
}

function mandy_update_nurse_application(apply_id, hospital_id, division_id, introduction, licence_img, certification_img, create_time, update_time, success, fail) {
    var dto = {};
    dto.apply_id = apply_id;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.licence_img = licence_img;
    dto.certification_img = certification_img;
    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/nurse_application.json", dto, success, fail);
}

function mandy_get_nurse_application(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/nurse_application.json", dto, success, fail);
}

function mandy_nurse_application_approval(apply_id, status, remark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.apply_id = apply_id;
    dto.status = status;
    dto.remark = remark;

    doPut("/mandy/nurse_application_approval.json", dto, success, fail);
}

//治疗师相关
function mandy_add_therapist_application(avatar_img, role, hospital_id, new_hospital, division_id, introduction, licence_img, certification_img, position, title, email, address, create_time, update_time, success, fail) {
    var dto = {};
    dto.role = {};
    dto.role.id = role;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.new_hospital = new_hospital;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.position = position;
    dto.title = title;
    dto.contact_email = email;
    dto.address = address;

    dto.licence_img = licence_img;
    dto.certification_img = certification_img;

    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPost("/mandy/therapist_application.json", dto, success, fail);
}

function mandy_update_therapist_application(apply_id, hospital_id, division_id, introduction, certification_img, create_time, update_time, success, fail) {
    var dto = {};
    dto.apply_id = apply_id;
    dto.hospital = {};
    dto.hospital.id = hospital_id;
    dto.division = {};
    dto.division.id = division_id;
    dto.introduction = introduction;
    dto.certification_img = certification_img;
    dto.create_time = create_time;
    dto.update_time = update_time;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/therapist_application.json", dto, success, fail);
}

function mandy_get_therapist_application(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/therapist_application.json", dto, success, fail);
}

function mandy_therapist_application_approval(apply_id, status, remark, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.apply_id = apply_id;
    dto.status = status;
    dto.remark = remark;

    doPut("/mandy/therapist_application_approval.json", dto, success, fail);
}

//住院总相关
function mandy_set_resident(mobile, success, fail) {
    var dto = {};

    dto.mobile = mobile;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/resident.json", dto, success, fail);
}

function mandy_delete_resident(mobile, success, fail) {
    var dto = {};

    dto.mobile = mobile;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doDelete("/mandy/resident.json", dto, success, fail);
}

//用户档案相关
function mandy_get_patient_record_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_record_list.json", dto, success, fail);
}

function mandy_get_patient_record(id, success, fail) {
    var dto = {};
    dto.patient_id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_record.json", dto, success, fail);
}

function mandy_add_patient_record(name, mobile, sex, birthday, blood_group, height, weight, married, location, is_default, success, fail) {
    var dto = {};
    dto.name = name;
    dto.mobile = mobile;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.blood_group = blood_group;
    dto.height = height;
    dto.weight = weight;
    dto.married = married;
    dto.location = location;
    dto.is_default = is_default;


    if (!addTokenToDTO(dto)) {
        return;
    }
    debugAlert(dto);
    doPost("/mandy/patient_record.json", dto, success, fail);
}

function mandy_update_patient_record(id, name, mobile, sex, birthday, blood_group, height, weight, married, location, is_default, success, fail) {
    var dto = {};
    dto.id = id;
    dto.name = name;
    dto.mobile = mobile;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.blood_group = blood_group;
    dto.height = height;
    dto.weight = weight;
    dto.married = married;
    dto.location = location;
    dto.is_default = is_default;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/patient_record.json", dto, success, fail);
}

function mandy_delete_patient_record(id, success, fail) {
    var dto = {};
    dto.patient_id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doDelete("/mandy/patient_record.json", dto, success, fail);
}

function mandy_get_my_patients_info(patient_id, success, fail) {
    var dto = {};
    dto.patient_id = patient_id;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_patient_info.json", dto, success, fail);
}

function mandy_get_patient_patient_remark_list(patient_id, success, fail) {
    var dto = {};
    dto.patient_id = patient_id;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_remark_list.json", dto, success, fail);
}

function mandy_get_patient_history_order(patient_id, success, fail) {
    var dto = {};
    dto.patient_id = patient_id;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_history_order.json", dto, success, fail);
}

function mandy_get_medical_staff_list_by_page_sync(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize, success, fail) {
    var dto = {};
    if (types != null) {
        dto.types = types;
    }
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.page = page;
    dto.page_size = pageSize;
    dto.tag_id = tagId;
    dto.sort_type = sortType;
    //if(!addTokenToDTO(dto)) {return;}
    doGetSyn("/mandy/medical_staff_list.json", dto, success, fail);
}

function mandy_get_srv_plug_medical_staff_list(hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.tag_id = tagId;
    dto.sort_type = sortType;
    dto.page = 1;
    dto.page_size = 10000;
    doGet("/mandy/srv_plus_staff.json", dto, success, fail);
}

function mandy_get_srv_plug_medical_staff_list_by_page(hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.tag_id = tagId;
    dto.sort_type = sortType;
    dto.page = page;
    dto.page_size = pageSize;
    doGet("/mandy/srv_plus_staff.json", dto, success, fail);
}

function mandy_get_home_srv_medical_staff_list(hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, success, fail) {
    mandy_get_home_srv_medical_staff_list_by_page(hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, 1, 10000, success, fail)
}

function mandy_get_home_srv_medical_staff_list_by_page(hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.tag_id = tagId;
    dto.sort_type = sortType;
    dto.page = page;
    dto.page_size = pageSize;
    doGet("/mandy/home_srv_staff.json", dto, success, fail);
}

function mandy_get_doctor_list(hospitalId, divisionId, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/doctor_list.json", dto, success, fail);
}

function mandy_get_doctor_pro_list(hospitalId, divisionId, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/doctor_pro_list.json", dto, success, fail);
}

function mandy_get_nurse_list(hospitalId, divisionId, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/nurse_list.json", dto, success, fail);
}

function mandy_get_therapist_list(hospitalId, divisionId, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/therapist_list.json", dto, success, fail);
}

//function mandy_get_bed(hospitalId, divisionId, provinceId, cityId, districtId, success, fail) {
//    var dto = {};
//    dto.hospital_id = hospitalId;
//    dto.division_id = divisionId;
//    dto.province_id = provinceId;
//    dto.city_id = cityId;
//    dto.district_id = districtId;
//    dto.page = 1;
//    dto.page_size = 100000;
//    //if (!addTokenToDTO(dto)) {
//    //    return;
//    //}
//    doGet("/mandy/bed.json", dto, success, fail);
//}

function mandy_get_bed_appoint_time(startTime, endTime, hospitalId, divisionId, success, fail) {
    var dto = {};
    dto.start_time = startTime;
    dto.end_time = endTime;
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    doGet("/mandy/bed_appoint_time.json", dto, success, fail);
}

function mandy_get_bed_hospital_list(hospitalId, divisionId, provinceId, cityId, districtId, page, pageSize, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    //dto.page = page;
    //dto.page_size = pageSize;
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    doGet("/mandy/bed_hospital.json", dto, success, fail);
}

//function mandy_get_bed_time(dayBegin, dayEnd, hospitalId, divisionId, success, fail) {
//    var dto = {};
//    dto.start_time = dayBegin;
//    dto.end_time = dayEnd;
//    dto.hospital_id = hospitalId;
//    dto.division_id = divisionId;
//    //if (!addTokenToDTO(dto)) {
//    //    return;
//    //}
//    doGet("/mandy/bed_appoint_time.json", dto, success, fail);
//}

function mandy_get_bed_hospital(hospitalId, divisionId, provinceId, cityId, districtId, page, pageSize, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    //dto.page = page;
    //dto.page_size = pageSize;
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    doGet("/mandy/bed_hospital.json", dto, success, fail);
}

function mandy_update_bed(id, hospitalId, divisionId, emptyBed, totalBed, success, fail) {
    var dto = {};
    dto.id = id;
    dto.hospital = {};
    dto.hospital_id = hospitalId;
    dto.division = {};
    dto.division_id = divisionId;
    dto.empty_bed = emptyBed;
    dto.total_bed = totalBed;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/bed.json", dto, success, fail);
}

function mandy_add_hospital_appointment(appointId, patientId, description, success, fail) {
    var dto = {};
    //dto.hospital = {};
    //dto.hospital.id = hospitalId;
    //dto.division = {};
    //dto.division.id = divisionId;
    dto.setting_id = appointId;
    dto.patient = {};
    dto.patient.id = patientId;
    //dto.start_time = start_time;
    dto.description = description;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/hospital_appointment.json", dto, success, fail);
}

function mandy_get_hospital_appointment(role, isFinished, start_time, end_time, success, fail) {
    var dto = {};
    dto.role = role;
    dto.is_finished = isFinished;
    dto.start_time = start_time;
    dto.end_time = end_time;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/hospital_appointment.json", dto, success, fail);
}

function mandy_get_hospital_appointment_page_list(role, isFinished, start_time, end_time, page, pageSize, success, fail) {
    var dto = {};
    dto.role = role;
    dto.is_finished = isFinished;
    dto.start_time = start_time;
    dto.end_time = end_time;
    dto.page = page;
    dto.page_size = pageSize;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/hospital_appointment.json", dto, success, fail);
}


//住院总审批住院申请
function mandy_put_hospital_appointment(appointId, status, opinion, update_date, success, fail) {
    var dto = {};
    dto.appoint_id = appointId;
    dto.status = status;
    dto.opinion = opinion;
    dto.update_date = update_date;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/hospital_appointment.json", dto, success, fail);
}


//function mandy_update_hospital_appointment(id, status, success, fail) {
//    var dto = {};
//    dto.id = id;
//    dto.status = status;
//    if (!addTokenToDTO(dto)) {
//        return;
//    }
//    doPut("/mandy/hospital_appointment.json", dto, success, fail);
//}

function mandy_delete_hospital_appointment(id, success, fail) {
    var dto = {};
    dto.appoint_id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doDelete("/mandy/hospital_appointment.json", dto, success, fail);
}

function mandy_put_hospital_appointment_confirm(id, success, fail) {
    var dto = {};
    dto.appoint_id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/hospital_appointment_confirm.json", dto, success, fail);
}

function mandy_get_srv_goods(worker_id, srv_type, success, fail) {
    var dto = {};
    dto.worker_id = worker_id;
    dto.srv_type = srv_type;
    //if(!addTokenToDTO(dto)) {return;}
    doGet("/mandy/srv_goods.json", dto, success, fail);
}

function mandy_add_srv_goods(patientId, goods_id, count, couponId, description, success, fail) {
    var dto = {};
    dto.patient_id = patientId;
    dto.goods_id = goods_id;
    dto.count = count;
    dto.coupon_id = couponId;
    dto.description = description;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/srv_goods_order.json", dto, success, fail);
}

function mandy_add_srv_goods_chat(patientId, workerId, count, couponId, description, success, fail) {
    var dto = {};
    dto.patient_id = patientId;
    dto.worker_id = workerId;
    dto.srv_name = "图文咨询";
    dto.count = count;
    dto.coupon_id = couponId;
    dto.description = description;
    //dto.payment = payment;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/srv_goods_order.json", dto, success, fail);
}

function mandy_get_srv_goods_order(orderId, success, fail) {
    var dto = {};
    dto.order_no = orderId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/srv_goods_order.json", dto, success, fail);
}

function mandy_get_order_info(orderId, success, fail) {
    var dto = {};
    dto.order_no = orderId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/order_info.json", dto, success, fail);
}


function mandy_delete_srv_goods_order(orderId, success, fail) {
    var dto = {};
    dto.order_no = orderId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doDelete("/mandy/srv_goods_order.json", dto, success, fail);
}


function mandy_get_purchased_srv_goods(role, srv_type, is_finished, start_time, end_time, success, fail) {
    mandy_get_purchased_srv_goods_by_page(role, srv_type, is_finished, start_time, end_time, 1, 10000, success, fail);
}

function mandy_get_purchased_srv_goods_by_page(role, srv_type, is_finished, start_time, end_time, page, pageSize, success, fail) {
    //role 1 为医生
    //srv_type
    var dto = {};
    dto.role = role;

    dto.srv_type = srv_type;
    dto.page = page;
    dto.page_size = pageSize;
    dto.is_finished = is_finished;
    dto.start_time = start_time;
    dto.end_time = end_time;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/purchased_srv_goods.json", dto, success, fail);
}

function mandy_add_free_question(patientId, images, description, success, fail) {
    var dto = {};
    dto.patient_id = patientId;
    if (images == null) {
        dto.images = [];
    } else {
        dto.images = images;
    }
    dto.description = description;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/question.json", dto, success, fail);
}

function mandy_set_free_question(order_id, success, fail) {
    var dto = {};
    dto.order_id = order_id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/question.json", dto, success, fail);
}

function mandy_get_not_replied_question(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/not_replied_question.json", dto, success, fail);
}

function mandy_get_focus(role, success, fail) {
    var dto = {};
    dto.role = role;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/focus.json", dto, success, fail);
}
function mandy_get_focus_syn(role, success, fail) {
    var dto = {};
    dto.role = role;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/focus.json", dto, success, fail);
}


function mandy_get_special_focus(role, success, fail) {
    var dto = {};
    dto.role = role;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/special_focus.json", dto, success, fail);
}

function mandy_get_special_focus_syn(role, success, fail) {
    var dto = {};
    dto.role = role;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/special_focus.json", dto, success, fail);
}


function mandy_add_focus(role, accId, success, fail) {
    var dto = {};
    dto.role = role;
    dto.focus_acc_id = accId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/focus.json", dto, success, fail);
}

function mandy_delete_focus(role, accId, success, fail) {
    var dto = {};
    dto.role = role;
    dto.focus_acc_id = accId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doDelete("/mandy/focus.json", dto, success, fail);
}

function mandy_get_is_focused(role, doctorId, success, fail) {
    var dto = {};
    dto.role = role;
    dto.focus_acc_id = doctorId;
    if (hasToken()) {
        if (!addTokenToDTO(dto)) {
            return;
        }
        doGet("/mandy/is_focused.json", dto, success, fail);
    }
}

function mandy_get_tks_letter(workerId, success, fail) {
    var dto = {};
    if (workerId == null) {
        if (!addTokenToDTO(dto)) {
            return;
        }
    } else {
        dto.worker_id = workerId;
    }
    doGet("/mandy/tks_letter.json", dto, success, fail);
}


function mandy_add_tks_letter(type, text, amount, medical_staff_id, patientId, success, fail) {
    var dto = {};
    dto.type = type;
    dto.text = text;
    dto.amount = amount;
    dto.medical_staff_id = medical_staff_id;
    dto.patient_id = patientId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/tks_letter.json", dto, success, fail);
}

function mandy_get_medical_service(id, srvType, success, fail) {
    var dto = {};
    if (id != null) {
        dto.worker_id = id;
    }
    if (srvType != null) {
        dto.srv_type = srvType;
    }
    if (hasToken()) {
        addTokenToDTO(dto);
    }
    doGet("/mandy/medical_service.json", dto, success, fail);
}

function mandy_set_service_enable(id, enable, success, fail) {
    var dto = {};
    dto.id = id;
    dto.enable = enable;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/service_enable.json", dto, success, fail);
}

//service_status

function mandy_post_medical_service(serviceDto, dtos, success, fail) {
    var dto = {};
    dto.srv_type = serviceDto.srv_type;
    dto.price = serviceDto.price;
    dto.setting_list = dtos;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/medical_service.json", dto, success, fail);
}

//function mandy_add_tks_letter(success,fail){
//    var dto = {};
//    if(!addTokenToDTO(dto)) {return;}
//    doGet("/mandy/tks_letter.json", dto, success, fail);
//}

function mandy_set_tks_letter(letter_id, status, success, fail) {
    var dto = {};
    dto.letter_id = letter_id;
    dto.status = status;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/tks_letter.json", dto, success, fail);
}

function mandy_get_my_patients(success, fail) {
    var dto = {};
    dto.page = 1;
    dto.page_size = 10000;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_patients.json", dto, success, fail);
}

function mandy_get_service_setting(workerId, srvType, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.worker_id = workerId;
    dto.srv_type = srvType;
    doGet("/mandy/service_setting.json", dto, success, fail);
}

function mandy_delete_service_setting(workerId, ids, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.worker_id = workerId;
    dto.ids = ids;
    doDelete("/mandy/service_setting.json", dto, success, fail);
}

function mandy_get_my_service_new_status(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_service_new_status.json", dto, success, fail);
}

//获取当前医生详细信息
function mandy_get_medical_staff_info(medicalStaffId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.medical_staff_id = medicalStaffId;
    doGet("/mandy/medical_staff.json", dto, success, fail);
}

//获取当前医生提交申请的信息
function mandy_get_personal_info(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/personal_info.json", dto, success, fail);
}

//获取科室人员
function mandy_get_division_staff_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/division_staff_list.json", dto, success, fail);
}

//获取住院总
function mandy_get_resident_staff_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/resident_staff_list.json", dto, success, fail);
}

//指定住院总
function mandy_resident_doctor(accId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.acc_id = accId;
    doPut("/mandy/resident.json", dto, success, fail);
}

//取消指定住院总
function mandy_cancle_resident_doctor(mobile, email, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.mobile = mobile;
    dto.email = email;
    doDelete("/mandy/resident.json", dto, success, fail);
}

//增加床位
function mandy_add_bed(hospital, division, startDate, emptyBed, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.hospital = hospital;
    dto.division = division;
    dto.start_date = startDate;
    dto.empty_bed = emptyBed;
    doPost("/mandy/bed.json", dto, success, fail);
}

//批量增加或修改床位
function mandy_post_bed(hospital, division, timeList, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.hospital = hospital;
    dto.division = division;
    dto.time_list = timeList;
    doPost("/mandy/bed.json", dto, success, fail);
}

//更新预约床位
function mandy_update_bed_num(recordId, num, type, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.record_id = recordId;
    dto.num = num;
    dto.type = type;
    doPut("/mandy/bed.json", dto, success, fail);
}

//删除预约床位
function mandy_delete_appoint_bed(recordIds, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.record_ids = recordIds;
    doDelete("/mandy/bed.json", dto, success, fail);
}

function mandy_get_district_list_syn(cityId, success, fail) {
    var dto = {};
    dto.city_id = cityId;
    doGetSyn("/mandy/district_list.json", dto, success, fail);
}

function mandy_add_service_remark(role, orderId, remarkLevel, attitudeRemarkLevel, skillRemarkLevel, timelyRemarkLevel, remark, success, fail) {
    var dto = {};
    dto.role = role;
    dto.order_id = orderId;

    if (attitudeRemarkLevel != null) {
        dto.attitude_remark_level = attitudeRemarkLevel;
    }
    if (skillRemarkLevel != null) {
        dto.skill_remark_level = skillRemarkLevel;
    }
    if (timelyRemarkLevel != null) {
        dto.timely_remark_level = timelyRemarkLevel;
    }
    if (remarkLevel != null) {
        dto.remark_level = remarkLevel;
    }
    dto.remark = remark;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/service_remark.json", dto, success, fail);
}

function mandy_get_staff_remark_list(workerId, success, fail) {
    var dto = {};
    if (workerId == null) {
        if (!addTokenToDTO(dto)) {
            return;
        }
    } else {
        dto.worker_id = workerId;
    }

    doGet("/mandy/staff_remark_list.json", dto, success, fail);
}

function mandy_get_patient_remark_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/staff_remark_list.json", dto, success, fail);
}


function mandy_get_free_dose(orderId, success, fail) {
    var dto = {};
    dto.order_id = orderId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/free_dose.json", dto, success, fail);
}

function getChargeUrl() {
    return buildUrl("/mandy/charge.json");
}

function getPayWayChargeUrl() {
    return buildUrl("/mandy/pay_way_charge.json");
}


function mandy_pay(orderNo, amount) {
    var bill = {};
    bill.order_no = orderNo;
    bill.amount = amount;
    var p = {};
    p.para = bill;
    p.url = getChargeUrl();

    if (activityManager != null) {
        activityManager.startPay(JSON.stringify(p));
    } else if (iOSActionManager != null) {
        iOSActionManager.startPay(p);
    }
    debugAlert("pay done 2");
}

function mandy_get_pay_way_order(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/pay_way_order.json", dto, success, fail);
}

function mandy_set_pay_way(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/pay_way_bind.json", dto, success, fail);
}

function mandy_get_pay_way(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/pay_way.json", dto, success, fail);
}

function mandy_get_all_tag_syn(success, fail) {
    var dto = {};
    doGetSyn("/mandy/all_tag.json", dto, success, fail);
}

function mandy_get_article_list(tag, type, page, pageSize, success, fail) {
    var dto = {};
    dto.tag = tag;
    dto.type = type;
    dto.page = page;
    dto.page_size = pageSize;
    doGet("/mandy/article_list.json", dto, success, fail);
}

function mandy_get_article(id, success, fail) {
    var dto = {};
    dto.id = id;
    doGet("/mandy/article.json", dto, success, fail);
}

function mandy_get_my_article(tag, page, pageSize, success, fail) {
    var dto = {};
    dto.tag = tag;
    dto.page = page;
    dto.page_size = pageSize;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_article.json", dto, success, fail);
}

function mandy_phone_chat(orderId, success, fail) {
    var dto = {};
    dto.order_id = orderId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/phone_chat.json", dto, success, fail);
}


function mandy_medical_application_total_data(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/medical_application_total_data.json", dto, success, fail);
}

function mandy_medical_application_list(page, pageSize, uname, job, mobile, hospitalId, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.uname = uname;
    dto.job = job;
    dto.mobile = mobile;
    dto.hospital_id = hospitalId;
    if (!addTokenToDTO(dto)) {
        return;
    }

    //alert(JSON.stringify(dto));
    doGet("/mandy/medical_application_list.json", dto, success, fail);
}

function mandy_medical_application_by_id(applyId, success, fail) {
    var dto = {};
    dto.apply_id = applyId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/medical_application_by_id.json", dto, success, fail);
}

function mandy_auth_medical_application(hospitalName, requestId, status, divisionId, smsMsg, roleId, success, fail) {
    var dto = {};
    dto.hospital_name = hospitalName;
    dto.apply_id = requestId;
    dto.status = status;
    dto.sms_msg = smsMsg;
    dto.division_id = divisionId;
    dto.role_id = roleId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/auth_medical_application.json", dto, success, fail);
}

function mandy_get_month_settlement(month, pageSize, page, success, fail) {
    var dto = {};
    dto.month = month;
    dto.page_size = pageSize;
    dto.page = page;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/monthly_settlement.json", dto, success, fail);
}

function mandy_auth_month_settlement(ids, status, chargebacks, chargebacksReason, success, fail) {
    var dto = {};
    dto.ms_ids = ids;
    dto.status = status;
    dto.chargebacks = chargebacks;
    dto.chargebacks_reason = chargebacksReason;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/auth_monthly_settlement.json", dto, success, fail);
}

function mandy_get_month_settlement_detail_by_id(accountId, month, success, fail) {
    var dto = {};
    dto.account_id = accountId;
    dto.month = month;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/month_settlement_detail_by_id.json", dto, success, fail);
}

function mandy_month_settlement_total_data(month, success, fail) {
    var dto = {};
    dto.month = month;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/month_settlement_total_data.json", dto, success, fail);
}

function mandy_month_settlement_refund(orderId, refundReson, success, fail) {
    var dto = {};
    dto.order_id = orderId;
    dto.refund_reson = refundReson;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doDelete("/mandy/month_settlement_refund.json", dto, success, fail);
}


function mandy_set_percentage(percentage, success, fail) {
    var dto = {};
    dto.percentage = percentage;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/monthly_settlement_config.json", dto, success, fail);
}

function mandy_get_percentage(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/monthly_settlement_config.json", dto, success, fail);
}

function mandy_get_recommend(position, pageSize, page, success, fail) {
    var dto = {};
    dto.position = position;
    dto.page_size = pageSize;
    dto.page = page;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/recommend.json", dto, success, fail);
}

function mandy_get_recommend_by_id(id, success, fail) {
    var dto = {};
    dto.id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/recommend_detail.json", dto, success, fail);
}

function mandy_add_recommend(recommend, success, fail) {
    var dto = {};
    dto.recommend = recommend;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/recommend.json", dto, success, fail);
}

function mandy_update_recommend(recommend, success, fail) {
    var dto = {};
    dto.recommend = recommend;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/recommend.json", dto, success, fail);
}
function mandy_get_my_wallet(startTime, endTime, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.start_time = startTime;
    dto.end_time = endTime;

    doGet("/mandy/my_wallet.json", dto, success, fail);
}


//管理端分页查询
function mandy_get_medical_staff_page_list(hospitalId, divisionId, station, provinceId, cityId, districtId, page, pageSize, success, fail) {
    var dto = {};
    dto.hospital_id = hospitalId;
    dto.division_id = divisionId;
    dto.province_id = provinceId;
    dto.city_id = cityId;
    dto.district_id = districtId;
    dto.station = station;
    dto.page = page;
    dto.page_size = pageSize;
    //if(!addTokenToDTO(dto)) {return;}
    doGet("/mandy/medical_staff_page_list.json", dto, success, fail);
}

function mandy_get_article_page_list(tag, type, page, pageSize, success, fail) {
    var dto = {};
    dto.tag = tag;
    dto.type = type;
    dto.page = page;
    dto.page_size = pageSize;
    doGet("/mandy/article_page_list.json", dto, success, fail);
}

//短信验证码
function mandy_getMobileCode(mobile, local, type, success, fail) {

    var reg = /^[1][3-8]\d{9}$/;

    var registerDTO = {};

    debugAlert(mobile);
    if (mobile == null || mobile == "") {
        alert("手机号码不能为空");
        return false;
    }

    if (!mobile.match(reg)) {
        alert("手机号输入错误");
        return false;
    }

    registerDTO.mobile = mobile;
    registerDTO.type = type;
    if (local != null) {
        registerDTO.local = local;
    }

    doGet("/mandy/mobile_code.json", registerDTO, success, fail);
}

function mandy_get_all_personal_tag(job, success, fail) {
    var dto = {};
    dto.job = job;
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    doGet("/mandy/all_personal_tag.json", dto, success, fail);
}

function mandy_get_my_personal_tag(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_personal_tag.json", dto, success, fail);
}

function mandy_set_my_personal_tag(tagIds, success, fail) {
    var dto = {};
    dto.tag_ids = tagIds;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/my_personal_tag.json", dto, success, fail);
}


function mandy_getRegisterMobileCode(mobile, local, success, fail) {
    mandy_getMobileCode(mobile, local, "registration", success, fail);
}

function mandy_getRsetPwdMobileCode(mobile, local, success, fail) {
    mandy_getMobileCode(mobile, local, "forgetpwd", success, fail);
}

function mandy_getModifyFirstMobileCode(mobile, local, success, fail) {
    mandy_getMobileCode(mobile, local, "modifyfirst", success, fail);
}

function mandy_getModifySecondMobileCode(mobile, local, success, fail) {
    mandy_getMobileCode(mobile, local, "modifysecond", success, fail);
}

function mandy_feedBack(softwareId, content, versionCode, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.content = content;
    dto.software_id = softwareId;
    dto.version_code = versionCode;
    doPost("/annie/opinion.json", dto, success, fail);
}

function send_msg_all(pushClients, msg, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.push_client = pushClients;
    dto.msg = msg;
    doPost("/mandy/push_to_all.json", dto, success, fail);
}

function mandy_set_introduction(introduction, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.introduction = introduction;
    doPut("/mandy/introduction.json", dto, success, fail);
}

function mandy_get_city(name, success, fail) {
    var dto = {};
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    dto.name = name;
    doGet("/mandy/city.json", dto, success, fail);
}

function mandy_get_city_sync(name, success, fail) {
    var dto = {};
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    dto.name = name;
    doGetSyn("/mandy/city.json", dto, success, fail);
}

function mandy_feedback_list(page, pageSize, uname, mobile, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.uname = uname;
    dto.mobile = mobile;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/feedback.json", dto, success, fail);
}

function mandy_hospital_page_list(hospital, page, pageSize, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    if (hospital != null) {
        dto.hospital_name = hospital.name;
        dto.level = hospital.level;
        dto.type = hospital.type;
    }
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/hospital_by_page.json", dto, success, fail);
}

function mandy_hospital_page_list_syn(hospital, page, pageSize, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    if (hospital != null) {
        dto.hospital_name = hospital.name;
        dto.level = hospital.level;
        dto.type = hospital.type;
    }
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/hospital_by_page.json", dto, success, fail);
}

function mandy_get_province_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/province_list.json", dto, success, fail);
}

//同步查询
function mandy_get_province_list_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/province_list.json", dto, success, fail);
}

function mandy_get_city_list(provinceId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.province_id = provinceId;
    doGet("/mandy/city_list.json", dto, success, fail);
}

function mandy_get_city_list_syn(provinceId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.province_id = provinceId;
    doGetSyn("/mandy/city_list.json", dto, success, fail);
}

function mandy_get_distinct_list(cityId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.city_id = cityId;
    doGet("/mandy/district_list.json", dto, success, fail);
}

function mandy_get_hospital_detail(hospitalId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.hospital_id = hospitalId;
    doGet("/mandy/hospital.json", dto, success, fail);
}

function mandy_update_hospital(hospitalDto, success, fail) {
    var dto = {};
    dto.hospital = hospitalDto;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/hospital.json", dto, success, fail);
}

function mandy_get_all_order_list(page, pageSize, staffName, patientName, srvName, status, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.staff_name = staffName;
    dto.patient_name = patientName;
    dto.srv_name = srvName;
    dto.status = status;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/all_order.json", dto, success, fail);
}

function mandy_all_hospital_appointment_list(page, pageSize, patientName, status, hospitalId, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.patient_name = patientName;
    dto.hospital_id = hospitalId;
    dto.status = status;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/all_hospital_appointment.json", dto, success, fail);
}

function mandy_profile_list_by_page(page, pageSize, name, mobile, job, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.name = name;
    dto.mobile = mobile;
    dto.job = job;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/profile_list_by_page.json", dto, success, fail);
}

function mandy_patient_list_by_page(page, pageSize, name, mobile, success, fail) {
    var dto = {};
    dto.page = page;
    dto.page_size = pageSize;
    dto.name = name;
    dto.mobile = mobile;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/patient_list_by_page.json", dto, success, fail);
}

function mandy_add_article(article, success, fail) {
    var dto = {};
    dto.title = article.title;
    dto.type = article.type;

    dto.cover_img = article.cover_img;
    dto.content = article.content;
    var tags = [];
    for (var i = 0; i < article.tags.length; i++) {
        var tag = {};
        tag.id = article.tags[i];
        tags[i] = tag;
    }
    dto.tags = tags;

    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/article.json", dto, success, fail);
}

function mandy_update_article(article, success, fail) {
    var dto = {};
    dto.id = article.id;
    dto.title = article.title;
    dto.type = article.type;

    dto.cover_img = article.cover_img;
    dto.content = article.content;
    var tags = [];
    for (var i = 0; i < article.tags.length; i++) {
        var tag = {};
        tag.id = article.tags[i];
        tags[i] = tag;
    }
    dto.tags = tags;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/article.json", dto, success, fail);
}

function mandy_get_charge_refer(orderId, success, fail) {
    var dto = {};
    dto.order_no = orderId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/charge_refer.json", dto, success, fail);
}

function mandy_get_activity_apply(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }


    doGet("/mandy/activity_apply.json", dto, success, fail);
}


function mandy_add_activity_apply(activityApply, success, fail) {
    var dto = {};
    dto = activityApply;
    if (hasToken()) {
        if (!addTokenToDTO(dto)) {
            return;
        }
    }

    doPost("/mandy/activity_apply.json", dto, success, fail);
}

function mandy_get_hospital_appointment_detail(appointId, success, fail) {
    var dto = {};
    dto.appoint_id = appointId;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/hospital_appointment_detail.json", dto, success, fail);
}

function mandy_get_coupon(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/coupon.json", dto, success, fail);
}

function mandy_get_my_coupon(isUsed, expireTime, success, fail) {
    var dto = {};

    dto.expire_time = expireTime;
    dto.is_used = isUsed;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/my_coupon.json", dto, success, fail);
}

function mandy_get_coupon_type(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/coupon_type.json", dto, success, fail);
}

function mandy_get_coupon_temp_page_list(name, type, page, pageSize, success, fail) {
    var dto = {};
    dto.name = name;
    dto.type = type;
    dto.page = page;
    dto.page_size = pageSize;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/coupon_temp_by_page.json", dto, success, fail);
}

function mandy_get_coupon_temp_by_id(id, success, fail) {
    var dto = {};
    dto.id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/coupon_temp.json", dto, success, fail);
}

function mandy_update_coupon_temp(coupon_temp, success, fail) {

    if (!addTokenToDTO(coupon_temp)) {
        return;
    }
    doPut("/mandy/coupon_temp.json", coupon_temp, success, fail);
}


function mandy_add_coupon_temp(coupon_temp, success, fail) {

    if (!addTokenToDTO(coupon_temp)) {
        return;
    }
    doPost("/mandy/coupon_temp.json", coupon_temp, success, fail);
}


function mandy_add_coupon_grant(coupon_grant, success, fail) {

    //1.创建优惠券
    var coupon = {};
    var coupon_id;

    coupon.name = coupon_grant.name;
    coupon.discount = coupon_grant.discount;
    coupon.term_of_validity = coupon_grant.term_of_validity;
    coupon.reduce_condition = coupon_grant.reduce_condition;
    coupon.platform_percent = coupon_grant.platform_percent;
    coupon.medical_percent = coupon_grant.medical_percent;
    coupon.is_medical_usable = coupon_grant.is_medical_usable
    coupon.description = coupon_grant.description;
    coupon.type = coupon_grant.type;
    coupon.start_time = coupon_grant.start_time;
    coupon.end_time = coupon_grant.end_time;

    if (!addTokenToDTO(coupon_grant)) {
        return;
    }

    console.log("mandy_add_coupon_grant.coupon:" + coupon);

    doPostSyn("/mandy/coupon.json", coupon_grant, function (msg) {
        if (msg.result_code != 0) {
            toastr.error(JSON.stringify(msg));
            toastr.error("优惠券添加失败");
        } else {
            processErrorCode(msg);
            if (msg.result_code != 0) {
                toastr.error(msg.result_msg);
            } else {
                console.log("coupon_id:" + msg.id);
                coupon_id = msg.id;
            }
        }
    }, fail);


    //2.发送
    var new_coupon_grant = {};

    new_coupon_grant.coupon_id = coupon_id;

    //补充发送人群的筛选条件
    if (coupon_grant.grant_condition != null) {
        new_coupon_grant.grant_condition = coupon_grant.grant_condition;
    }

    new_coupon_grant.name = coupon_grant.grant_name;
    new_coupon_grant.description = coupon_grant.grant_description;
    new_coupon_grant.patient_ids = coupon_grant.patient_ids;

    if (!addTokenToDTO(new_coupon_grant)) {
        return;
    }

    doPost("/mandy/coupon_grant.json", new_coupon_grant, success, fail);

}

function mandy_get_coupon_type_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/coupon_type.json", dto, success, fail);
}

function mandy_get_coupon_grant_by_page(name, page, page_size, success, fail) {
    var dto = {};
    dto.name = name;
    dto.page = page;
    dto.page_size = page_size;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/coupon_grant_by_page.json", dto, success, fail);
}

function mandy_get_coupon_grant_by_id(id, success, fail) {
    var dto = {};
    dto.id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/coupon_grant_by_id.json", dto, success, fail);
}

function mandy_get_citys_syn(ids, success, fail) {
    var dto = {};
    dto.city_ids = ids;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/citys.json", dto, success, fail);
}

function mandy_get_recommend_by_position(position, page_size, page, success, fail) {
    var dto = {};
    //if (!addTokenToDTO(dto)) {
    //    return;
    //}
    dto.position = position;
    dto.page_size = page_size;
    dto.page = page;
    doGet("/mandy/recommend_by_position.json", dto, success, fail);
}

//收藏文章
function mandy_post_collection(article_id, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.article_id = article_id;
    doPost("/mandy/collection.json", dto, success, fail);
}

//获取收藏的文章列表
function mandy_get_my_collection(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_collection.json", dto, success, fail);
}

//取消收藏
function mandy_delete_collection(article_id, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.article_id = article_id;
    doDelete("/mandy/collection.json", dto, success, fail);
}

//检查文章是否被收藏
function mandy_get_is_collected(article_id, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.article_id = article_id;
    doGet("/mandy/is_collected.json", dto, success, fail);
}

//医疗文章点赞
function mandy_post_like(token, article_id, success, fail) {
    var dto = {};
    //if(!addTokenToDTO(dto)){
    //    return;
    //}
    if (token != null && token != "") {
        dto.token = token;
    }
    dto.article_id = article_id;
    doPost("/mandy/like.json", dto, success, fail);
}

//医疗文章取消点赞
function mandy_delete_like(token, article_id, success, fail) {
    var dto = {};
    //if(!addTokenToDTO(dto)){
    //    return;
    //}
    if (token != null && token != "") {
        dto.token = token;
    }
    dto.article_id = article_id;
    doDelete("/mandy/like.json", dto, success, fail);
}

//分享计数
function mandy_post_share(article_id, success, fail) {
    var dto = {};
    dto.article_id = article_id;
    doPost("/mandy/share.json", dto, success, fail);
}

//分享计数
function mandy_delete_share(article_id, success, fail) {
    var dto = {};
    dto.article_id = article_id;
    doDelete("/mandy/share.json", dto, success, fail);
}

function mandy_get_patient_group(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/patient_group.json", dto, success, fail);
}

function mandy_get_patient_list_by_group_id(groupId, success, fail) {
    var dto = {};
    dto.group_id = groupId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/patient_list_by_group.json", dto, success, fail);
}

function mandy_get_patient_list_by_group_id_syn(groupId, success, fail) {
    var dto = {};
    dto.group_id = groupId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/patient_list_by_group.json", dto, success, fail);
}

function mandy_add_patient_group(patient_group, success, fail) {

    if (!addTokenToDTO(patient_group)) {
        return;
    }
    doPost("/mandy/patient_group.json", patient_group, success, fail);
}

function mandy_delete_patient_group(patient_group_id, success, fail) {
    var dto = {};
    var group_ids = [];
    group_ids[0] = patient_group_id
    dto.group_ids = group_ids;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doDelete("/mandy/patient_group_ids.json", dto, success, fail);
}

function mandy_move_patient_to_group(patient_id, old_group_id, group_id, success, fail) {
    var dto = {};
    var patient_ids = [];
    patient_ids[0] = patient_id
    dto.group_id = group_id;
    dto.old_group_id = old_group_id;
    dto.patient_ids = patient_ids;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/move_to_group.json", dto, success, fail);
}

function mandy_move_patient_out_group(patient_id, group_id, success, fail) {
    var dto = {};
    var patient_ids = [];
    patient_ids[0] = patient_id
    dto.group_id = group_id;
    dto.patient_ids = patient_ids;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/move_out_group.json", dto, success, fail);
}

function mandy_update_patient_group(patient_group, success, fail) {

    if (!addTokenToDTO(patient_group)) {
        return;
    }

    doPut("/mandy/patient_group.json", patient_group, success, fail);
}

function mandy_get_medical_title_list(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/medical_title_list.json", dto, success, fail);
}

function mandy_get_my_no_prescription_hospitalization(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_no_prescription_hospitalization.json", dto, success, fail);
}

function mandy_get_my_exist_prescription_hospitalization(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_exist_prescription_hospitalization.json", dto, success, fail);
}

function mandy_get_group_exist_therapist_hospitalization(groupId, success, fail) {
    var dto = {};
    dto.group_id = groupId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/group_exist_therapist_hospitalization.json", dto, success, fail);
}

function mandy_get_group_no_therapist_hospitalization(groupId, success, fail) {
    var dto = {};
    dto.group_id = groupId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/group_no_therapist_hospitalization.json", dto, success, fail);
}

function mandy_get_treatment_group_list(hos_id, success, fail) {
    var dto = {};
    dto.hospital_id = hos_id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/treat_group_list.json", dto, success, fail);
}


//这里通过token拿治疗项目，避免医生所属医院或科室发生变化后，前台无法及时知道
function mandy_get_treat_item_list_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/treat_item_list.json", dto, success, fail);
}

function mandy_get_diagnose_list_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.timestamp = new Date().getTime();

    doGetSyn("/mandy/diagnose_list.json", dto, success, fail);
}

function mandy_add_diagnose(name, success, fail) {
    var dto = {};
    dto.name = name;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/diagnose.json", dto, success, fail);
}

function mandy_delete_diagnose(id, success, fail) {
    var dto = {};
    dto.id = id;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doDelete("/mandy/diagnose.json", dto, success, fail);
}

//这里通过token拿床位，避免医生所属医院或科室发生变化后，前台无法及时知道
function mandy_get_bed_list_syn(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGetSyn("/mandy/bed_list.json", dto, success, fail);
}

function mandy_post_hospitalization_patient_info(name, sex, birthday, mobile, success, fail) {
    var dto = {};
    dto.name = name;
    dto.mobile = mobile;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.division_id = hosDivId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/hospitalization_patient_info.json", dto, success, fail);
}

function mandy_set_hospitalization_patient_info(hospitalizationId, name, sex, birthday, mobile, success, fail) {
    var dto = {};
    dto.hospitalization_id = hospitalizationId;
    dto.name = name;
    dto.mobile = mobile;
    dto.sex = sex;
    dto.birthday = birthday;
    dto.division_id = hosDivId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPut("/mandy/hospitalization_patient_info.json", dto, success, fail);
}

function mandy_get_patient_hospitalization(hospitalizationId, success, fail) {
    var dto = {};
    dto.hospitalization_id = hospitalizationId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/patient_hospitalization.json", dto, success, fail);
}

function mandy_get_patient_prescription(prcp_id, success, fail) {
    var dto = {};

    dto.prcp_id = prcp_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_prescription.json", dto, success, fail);
}

function mandy_get_prescription_list(success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/prescription_list.json", dto, success, fail);
}

//查看某个患者当天的治疗记录
function mandy_get_patient_treatment_record(patient_id, success, fail) {
    var dto = {};

    dto.patient_id = patient_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_treatment_record.json", dto, success, fail);
}

function mandy_update_prescription_item_sche(patient_id, perscriptionItemSches, success, fail) {
    var dto = {};

    dto.list = perscriptionItemSches;
    dto.patient_id = patient_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/prescription_item_sche.json", dto, success, fail);
}

function mandy_update_treatment_record_status(record_ids, status, success, fail) {
    var dto = {};

    dto.record_ids = record_ids;
    dto.status = status;

    if (!addTokenToDTO(dto)) {
        return;
    }

    debugAlert(dto);

    doPut("/mandy/treatment_record_status.json", dto, success, fail);
}

//治疗师治疗完成
function mandy_update_prescription_item_status(prcp_id, is_finish, success, fail) {
    var dto = {};

    dto.prcp_id = prcp_id;
    dto.is_finish = is_finish;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doPut("/mandy/prescription_item_status.json", dto, success, fail);
}

function mandy_post_record_hospitalization(hosNum, patientId, bedNum, bedId, medicalId, divId, hospitalId,
                                           disInfo, diagnose, treatArea, checkInTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.hos_num = hosNum;

    dto.patient = {};
    dto.patient.id = patientId;

    dto.bed = {};
    dto.bed.id = bedId;
    dto.bed.num = bedNum;

    dto.medical = {};
    dto.medical.id = medicalId;

    dto.division = {};
    dto.division.id = divId;

    dto.hospital = {};
    dto.hospital.id = hospitalId;

    dto.disease_info = disInfo;
    dto.diagnose = diagnose;
    dto.treat_area = treatArea;
    dto.check_in_time = checkInTime;

    doPost("/mandy/record_hospitalization.json", dto, success, fail);
}

function mandy_set_record_hospitalization(id, hosNum, patientId, bedNum, bedId, medicalId, divId, hospitalId,
                                          disInfo, diagnose, treatArea, checkInTime, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.id = id;

    dto.hos_num = hosNum;

    dto.patient = {};
    dto.patient.id = patientId;

    dto.bed = {};
    dto.bed.id = bedId;
    dto.bed.num = bedNum;

    dto.medical = {};
    dto.medical.id = medicalId;

    dto.division = {};
    dto.division.id = divId;

    dto.hospital = {};
    dto.hospital.id = hospitalId;

    dto.disease_info = disInfo;
    dto.diagnose = diagnose;
    dto.treat_area = treatArea;
    dto.check_in_time = checkInTime;

    doPut("/mandy/record_hospitalization.json", dto, success, fail);
}

function mandy_get_my_treatment_record(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/my_treatment_record.json", dto, success, fail);
}

function mandy_get_group_treatment_record(groupid, success, fail) {
    var dto = {};
    dto.group_id = groupid;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/treatment_group_record.json", dto, success, fail);
}

function mandy_get_therapist_prescription_hospitalization(success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    doGet("/mandy/therapist_prescription_hospitalization.json", dto, success, fail);
}

function mandy_post_check_out(hospitalizationId, success, fail) {
    var dto = {};
    if (!addTokenToDTO(dto)) {
        return;
    }
    dto.hospitalization_id = hospitalizationId;
    doPost("/mandy/check_out.json", dto, success, fail);
}

function mandy_get_prescription_item_patient(patient_id, success, fail) {
    var dto = {};

    dto.patient_id = patient_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/prescription_item_patient.json", dto, success, fail);
}

function mandy_get_patient_hospitalization_by_prcp_id(prcp_id, success, fail) {
    var dto = {};

    dto.prcp_id = prcp_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_hospitalization_by_prcp_id.json", dto, success, fail);
}

function mandy_get_patient_hospitalization_by_patient_id(patient_id, success, fail) {
    var dto = {};

    dto.patient_id = patient_id;

    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/patient_hospitalization_by_patient_id.json", dto, success, fail);
}

function mandy_add_treatment_record(items, success, fail) {
    var dto = {};
    dto.treatment_record_list = items;
    //dto.start_time = startTime;
    //dto.end_time = endTime;
    //dto.therapist ={};
    //dto.therapist.id =therapistId;
    //dto.prescription ={};
    //dto.prescription.id =prescriptionId;
    //dto.treatment_group ={};
    //dto.treatment_group.id =treatmentGroupId;
    if (!addTokenToDTO(dto)) {
        return;
    }
    doPost("/mandy/treatment_record.json", dto, success, fail);
}

//function mandy_add_gauge_record(items, success, fail) {
//    var dto = {};
//    dto.gauge_record_list=items;
//    //dto.start_time = startTime;
//    //dto.end_time = endTime;
//    //dto.therapist ={};
//    //dto.therapist.id =therapistId;
//    //dto.prescription ={};
//    //dto.prescription.id =prescriptionId;
//    //dto.treatment_group ={};
//    //dto.treatment_group.id =treatmentGroupId;
//    if (!addTokenToDTO(dto)) {
//        return;
//    }
//    doPost("/mandy/gauge_record.json", dto, success, fail);
//}

function mandy_get_my_message_by_page_syn(bussTypes, pageSize, time, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    //dto.current_page = currentPage;
    dto.page_size = pageSize;
    dto.time = time;
    dto.buss_types = bussTypes;

    doGetSyn("/mandy/my_message_by_page.json", dto, success, fail);
}


//function mandy_get_group_members_scheduling(startTime, endTime, success, fail){
//    var dto = {};
//
//    if (!addTokenToDTO(dto)) {
//        return;
//    }
//
//    dto.start_time = startTime;
//    dto.end_time = endTime;
//
//    doGet("/mandy/group_members_scheduling.json", dto, success, fail);
//}

function grey_put_my_task_success(myTaskId, success, fail) {
    var dto = {};

    if (!addTokenToDTO(dto)) {
        return;
    }

    dto.gauge_record_id = myTaskId;

    doPut("/mandy/gauge_record_success.json", dto, success, fail);
}

//该接口被重写了，noted by lanlan.zeng
//function mandy_get_therapist_emr_by_page(page, page_size, success, fail) {
//    var dto = {};
//
//    dto.page = page;
//    dto.page_size = page_size;
//
//    if (!addTokenToDTO(dto)) {
//        return;
//    }
//
//    doGet("/mandy/therapist_emr_by_page.json", dto, success, fail);
//}

function mandy_get_arranged_times(prescriptionId, therapistId, status, success, fail) {
    var dto = {};

    dto.prescription_id = prescriptionId;
    dto.therapist_id = therapistId;
    dto.status = status;
    if (!addTokenToDTO(dto)) {
        return;
    }

    doGet("/mandy/arranged_times.json", dto, success, fail);
}
function mandy_get_diagnose_list(success, fail) {
    // var dto = {};
    // if (!addTokenToDTO(dto)) {
    //     return;
    // }
    doGet("/mandy/diagnose_list.json", null, success, fail);

}
*/